home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------------------
- *
- * Apple Macintosh Developer Technical Support
- *
- * Installer 3.4 sample: Action Atoms
- *
- * File: SetLockBit.c - c Source
- *
- * by: Rich Kubota
- * updated for use with Installer 3.4, 9/1/92
- *
- * Copyright © 1990-1992 Apple Computer, Inc.
- * All rights reserved.
- *
- * Purpose: Sample to demonstrate setting the file lock bit. This action
- * atom code resource must be called through a post installation action
- * atom. In the selector field, pass in the name of the target 'infs'
- * resource id. The code resource gets the resource, converts the partial
- * path name field to a pascal string, then calls, SetFLock. A result of
- * true is always returned so as not to abort the installation.
- *
- * This action atom is designed for use by Installer 3.3 and 3.4 only as it
- * returns a longint result instead of a Boolean
- *
- * Note: If a target file is locked, then the Installer will report an error
- * to the user alerting them to the fact that the target file must be
- * manually unlocked.
- *----------------------------------------------------------------------------*/
-
- #if 0
-
- C -r -b SetLockBit.c
- Link -ra =resPurgeable -t rsrc -c RSED -rt infn=10000 ∂
- -m SETLOCKBIT -sg SetLockBit ∂
- SetLockBit.c.o ∂
- "{Libraries}"Interface.o ∂
- -o SetLockBit.rsrc
-
- #endif
-
- #include <Types.h>
- #include <Resources.h>
- #include <Files.h>
- #include "ActionAtomIntf.h"
-
- /* define record structure of 'infs' resource so that we can access the target file path */
-
- struct infsRec {
- long fileType;
- long creator;
- long creationDate;
- short fileSpecFlags;
- Str255 pathName;
- };
-
- typedef struct infsRec infsRec;
- typedef infsRec **infsHdl;
-
- /* protoypes */
- void makePStr(char *fm, char *to);
-
-
- pascal long SETLOCKBIT(AAPBRecPtr myAAPBPtr)
- {
- OSErr err;
- infsHdl resH;
-
- if (myAAPBPtr->whichStage == after) { // make sure that this is the right stage
- // and that the atom is not being called
- // as a result of a cancel operation
-
- resH = (infsHdl)GetResource('infs', myAAPBPtr->aaRefCon);
- if (resH)
- err = SetFLock((*resH)->pathName, myAAPBPtr->targetVRefNum);
- }
- return noErr; // return noErr unless it is necessary to report otherwise.
- }
-